﻿using AutoMapper;
using Common.Communal;
using ERP.Domain.Workorders;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Sell.Api.Write.Application.Command.WorkordersCommand;

namespace Sell.Api.Write.Controllers.Workorders
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WorkorderController : ControllerBase
    {
        public IMediator Mediator { get;}
        public WorkorderController(IMediator _Mediator)
        {
            Mediator = _Mediator;
        }
        /// <summary>
        /// 新增生产工单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> WorkorderAdd(WorkorderAddCommand request)
        {
            return await Mediator.Send(request);
        }
    }
}
